/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

$dark-bright: lighten($dark, 15%);

.CodeMirror {
  height: auto;
}

.CodeMirror-scroll {
  min-height: 500px;
}

.namespace-editor {
  .CodeMirror-scroll {
    min-height: 204px;
  }
}

.cm-s-hashi,
.cm-s-hashi-read-only {
  &.CodeMirror {
    background-color: $dark-3;
    color: $grey-blue;
    border: none;
    font-family: $family-monospace;
    -webkit-font-smoothing: auto;
    line-height: 1.4;
  }

  .CodeMirror-gutters {
    background-color: $dark-2;
    border: none;
  }

  .CodeMirror-cursor {
    border-left: solid thin $white-ter;
  }

  .CodeMirror-linenumber {
    color: $dark-bright;
  }

  &.CodeMirror-focused div.CodeMirror-selected {
    background: rgba(255, 255, 255, 0.1);
  }

  .CodeMirror-line::selection,
  .CodeMirror-line > span::selection,
  .CodeMirror-line > span > span::selection {
    background: rgba(255, 255, 255, 0.1);
  }

  span.cm-comment {
    color: $grey;
  }

  span.cm-string,
  span.cm-string-2 {
    color: $nomad-green;
  }

  span.cm-number {
    color: $serf-red;
  }

  span.cm-variable {
    color: $packer-blue;
  }

  span.cm-variable-2 {
    color: $packer-blue;
  }

  span.cm-def {
    color: $nomad-green;
  }

  span.cm-operator {
    color: $grey;
  }
  span.cm-keyword {
    color: $yellow;
  }

  span.cm-atom {
    color: $terraform-purple-bright;
  }

  span.cm-meta {
    color: $nomad-green;
  }

  span.cm-tag {
    color: $nomad-green;
  }

  span.cm-attribute {
    color: $consul-pink;
  }

  span.cm-qualifier {
    color: $consul-pink;
  }

  span.cm-property {
    color: $nomad-green;
  }

  span.cm-variable-3 {
    color: $consul-pink;
  }

  span.cm-builtin {
    color: $consul-pink;
  }

  .CodeMirror-activeline-background {
    background: $black-ter;
  }

  .CodeMirror-matchingbracket {
    text-decoration: underline;
    color: $white;
  }
}

.cm-s-auto-height.CodeMirror {
  height: auto;
}

.cm-s-hashi-read-only {
  &.CodeMirror {
    background-color: $dark-2;
  }

  .CodeMirror-gutters {
    background-color: $dark-2;
  }
}

header.run-job-header {
  display: grid;
  grid-template-columns: 1fr auto;
  margin-bottom: 2rem;
  gap: 0 1rem;
  align-items: end;
  & > h1 {
    grid-column: -1 / 1;
  }
}

.job-spec-upload {
  .button {
    cursor: pointer;
  }
  input {
    width: 100%;
    height: 100%;
    position: absolute;
    display: none;
  }
}

.buttonset {
  display: flex;
  justify-content: space-between;

  &.sticky {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 0.5rem 0;

    &.pull-left {
      justify-content: flex-start;
    }
  }
}

.job-definition-select {
  border: 1px solid $grey-blue;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr 1fr;
  padding: 0.25rem 0.5rem;
  margin: 0rem 1rem;

  &.disabled {
    opacity: 0.5;
    pointer-events: none;
  }

  button {
    height: auto;
    padding: 0 0.5rem;
    background: transparent;
    transition: 0.1s;

    &:hover {
      background: rgba(255, 255, 255, 0.5);
    }

    &.is-active {
      background: $white;
    }
  }
}

.job-editor-alerts {
  display: grid;
  grid-template-rows: repeat(minmax(200px, 1fr), auto-fit);
  gap: 10px;
  margin-bottom: 10px;
}
